package cn.bitkit.tools.crypto;

import cn.bitkit.base.util.StringUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;

@Getter
@Setter
@ToString
public class KeyMap {
	
	private String privateKey;
	private String publicKey;
	
	public KeyMap() {
		super();
	}

	public KeyMap(KeyPair keyPair) {
		PublicKey publicKey = keyPair.getPublic();
		PrivateKey privateKey = keyPair.getPrivate();
		this.privateKey = StringUtil.encodeBase64(privateKey.getEncoded());
		this.publicKey = StringUtil.encodeBase64(publicKey.getEncoded());
	}
	public KeyMap(String privateKey, String publicKey) {
		super();
		this.privateKey = privateKey;
		this.publicKey = publicKey;
	}

}
